SQL:2011
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
top
SQL:2011 or ISO/IEC 9075:2011 (under the general title "Information technology – Database languages – SQL") is the seventh revision of the ISO (1987) and ANSI (1986) standard for the SQL database query language. It was formally adopted in December 2011.cite-ref-1[1] The standard consists of 9 parts which are described in detail in SQL. The next version is SQL:2016.
Contents
• See also
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
New features
One of the main new features is improved support for temporal databases.cite-ref-2[2]cite-ref-3[3] Language enhancements for temporal data definition and manipulation include:
• Time period definitions use two standard table columns as the start and end of a named time period, with closed set-open set semantics. This provides compatibility with existing data models, application code, and tools
• Definition of application time period tables (elsewhere called valid time tables), using the PERIOD FOR annotation
• Update and deletion of application time rows with automatic time period splitting
• Temporal primary keys incorporating application time periods with optional non-overlapping constraints via the WITHOUT OVERLAPS clause
• Temporal referential integrity constraints for application time tables
• Application time tables are queried using regular query syntax or using new temporal predicates for time periods including CONTAINS, OVERLAPS, EQUALS, PRECEDES, SUCCEEDS, IMMEDIATELY PRECEDES and IMMEDIATELY SUCCEEDS (which are modified versions of Allen’s interval relations)
• Definition of system-versioned tables (elsewhere called transaction time tables), using the PERIOD FOR SYSTEM_TIME annotation and WITH SYSTEM VERSIONING modifier. System time periods are maintained automatically. Constraints for system-versioned tables are not required to be temporal and are only enforced on current rows
• Syntax for time-sliced and sequenced queries on system time tables via the AS OF SYSTEM TIME and VERSIONS BETWEEN SYSTEM TIME ... AND ... clauses
• Application time and system versioning can be used together to provide bitemporal tables
Support in database management systems
Oracle 12c supports temporal functionality in compliance with SQL:2011.cite-ref-9[9] Versions 9,cite-ref-10[10]cite-ref-11[11] 10g and 11g implement the time-sliced queries in what they call Flashback Queries, using the alternative syntax AS OF TIMESTAMP.cite-ref-12[12] Notably both of Oracle's implementations depend on the database's rollback segment and so only allow temporal queries against recent changes which are still being retained for backup.
Microsoft SQL Server (version 2016) implements temporal tables with SYSTEM_VERSIONING.cite-ref-13[13]
PostgreSQL requires installation of the temporal_tables extension. Temporal Tables Extension supports the system-period temporal tables only, but does not follow the SQL:2011 design.
CockroachDB has supported AS OF SYSTEM TIME queries since at least v1.0.7.cite-ref-16[16]cite-ref-17[17]
See also
References
cite-note-11. ↑ citerefpaulley2011Paulley (December 16, 2011), "SQL:2011 is published", IA, Sybase, archived from the original (blog) on July 11, 2012
cite-note-22. ↑ Zemke, Fred. "What's new in SQL:2011 Archived 2013-08-10 at the Wayback Machine". ACM SIGMOD Record 41.1 (2012): 67-73
cite-note-33. ↑ Kulkarni, Krishna, and Jan-Eike Michels. "Temporal features in SQL: 2011 Archived 2012-11-15 at the Wayback Machine". ACM SIGMOD Record 41.3 (2012): 34-43
cite-note-44. ↑ "SAP Help Portal".
cite-note-55. ↑ "SAP Help Portal".
cite-note-66. ↑ "SAP Help Portal".
cite-note-99. ↑ "Implementing Temporal Validity".
cite-note-1010. ↑ "flashback query in oracle 9i". www.oracle-developer.net. Retrieved 2024-11-01.
cite-note-1111. ↑ "Flashback Query". oracle-base.com. Retrieved 2024-11-01.
cite-note-1212. ↑ "Database SQL Reference".
cite-note-1313. ↑ "Temporal Tables - SQL Server". 16 October 2023.
cite-note-1414. ↑ "Changes & Improvements in MariaDB 10.3".
cite-note-1515. ↑ "Application-Time Periods".
cite-note-1616. ↑ "AS OF SYSTEM TIME | CockroachDB Docs".
cite-note-1717. ↑ "Time-Travel Queries: SELECT witty_subtitle FROM THE FUTURE". Cockroach Labs. 22 June 2016.
External links
• "SQL:2011", Catalogue (webshop), ISO.
• Part 1: Framework (SQL/Framework) (draft; PDF), JTC1SC32, 2011-08-06.
• Part 14: XML-Related Specifications (SQL/XML) (draft; PDF), JTC1SC32, 2011-08-06.
• List of further freely available Final Committee Drafts (search).
• Oracle 11g Total Recall Whitepaper (PDF), Oracle, 2009-09-01.